﻿$$ std.tpl
$$
$$ 标准函数库模板
$$

statement: 打印 {语句} ->
(write-line {语句})

statement: 令[{a}={b}，]+ 求[{c}]+ ->
(let ([({a} {b})]+) [{c}]+)

statement: 定义全局变量{a}为{b} ->
(defparameter {a} {b})

statement: 定义常量{a}为{b} ->
(defconstant {a} {b})

statement: 定义  {函数} 为 [{a}]+ ->
(defun {函数} () [{a}]+)

statement: 定义 {a} 的 {函数} 为 [{b}]+ ->
(defun {函数} ({a}) [{b}]+)

statement: 定义 {a} 与 {b} 的 {函数} 为[{c}]+ ->
(defun {函数} ({a} {b}) [{c}]+)

statement: 定义 {a}[、{b}]+与{c} 的 {函数} 为[{d}]+ ->
(defun {函数} ({a} [{b}]+ {c}) [{d}]+)

statement: {函数} ->
({函数})

statement: {a} 的 {函数} ->
({函数} {a})

statement: {a} 与 {b} 的 {函数} ->
({函数} {a} {b})

statement: {a}[、{b}]+与{c} 的 {函数} ->
({函数} {a} [{b}]+ {c})

statement: [当{a}时，则为{b}；]+否则为{c} ->
(cond [({a} {b})]+ (else {c}) )

statement: [当{a}时，则为{b}；]+ ->
(cond [({a} {b})]+ )

statement: 如果{a}，则{b}，否则{c} ->
(if {a} {b} {c})

statement: 如果{a}，则{b} ->
(if {a} {b})

statement: 将{a}应用于{b} ->
(map {a} {b})

statement: [{a}，]*{b} ->
(progn [{a}]* {b})

statement: 读取输入 ->
(read)

statement: 设{a}为{b}[，{c}为{d}]* ->
(setf {a} {b} [{c} {d}]*)

statement: 循环执行{语句}：[设{变量}的初值为{初值}，新值为{新值}；]+当{终止条件}时，{返回结果} ->
(do ([({变量} {初值} {新值})]+) ({终止条件} {返回结果}) {语句})

statement: 对于{变量}，遍历{列表}，循环执行{语句} ->
(dolist ({变量} {列表}) {语句})

statement: 格式化输出{a}，参数[{b}]+ ->
(format t {a} [{b}]+)

statement: 格式化输出{a} ->
(format nil "~%~S" {a})

statement: 将{函数}应用于[{列表}]+ ->
(apply {函数} [{列表}]+)

statement: 对[{参数}]+调用{函数} ->
(funcall {函数} [{参数}]+)

statement: lambda[{参数}]+：{表达式} ->
(lambda ([{参数}]+) {表达式})

statement: 函数lambda[{参数}]+：{表达式} ->
#'(lambda ([{参数}]+) {表达式})




